import time

from selenium.webdriver.common.by import By
from Base.Base import Base
class Page(Base):
    # 点击登录跳转页面
    login_loc=(By.XPATH,'/html/body/div[2]/div/div[1]/div/a[1]')
    # 断言帐号登录
    dy1_loc=(By.XPATH,'//*[@id="loginform"]/div/div/div/div/div[1]/div[1]/a[1]')
    # 输入账号
    user_loc=(By.ID,'userName')
    # 输入密码
    pwd_loc=(By.ID,'password')
    # 验证码
    # 点击登录按钮跳转
    loginbtn_loc=(By.XPATH,'//*[@id="save"]')
    # 点击确定
    sure_loc=(By.XPATH,'//*[@id="bindSub"]')
    # 断言hi，jxw225264768
    dy2_loc=(By.XPATH,'/html/body/div[2]/div/div[1]/div/p/span')

    def login(self):
        self.click(self.login_loc)
    def dy1(self):
        return self.text(self.dy1_loc)
    def user(self):
        self.send_keys(self.user_loc,'18986670716')
    def pwd(self):
        self.send_keys(self.pwd_loc,'Aa123456')
    def loginbtn(self):
        self.click(self.loginbtn_loc)
    def sure(self):
        self.click(self.sure_loc)

    def dy2(self):
        return self.text(self.dy2_loc)

    def jiuxian_luoji(self):
        self.open_url('https://www.jiuxian.com/')
        self.login()
        time.sleep(2)
        yq1=self.dy1()
        self.user()
        self.pwd()
        time.sleep(10)
        self.loginbtn()
        self.sure()
        time.sleep(3)
        self.dy2()
        return yq1
